/*
package com.fragment;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Xml;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.adapter.HorgradeAdapter;
import com.adapter.MainRecyclerViewAdapter;
import com.bean.FreeListBean;
import com.bean.HomeListBean;
import com.bean.MentalBean;
import com.bean.MyCourseBean;
import com.bean.RecommendListBean;
import com.myapp.MyApp;
import com.myview.CustomProgressDialog;
import com.myview.HorizontalListView;
import com.myview.PullLoadMoreRecyclerView;
import com.myview.RatioImageView;
import com.util.DensityUtil;
import com.util.GlideUtils;
import com.util.InfoEventMessage;
import com.util.MyLog;
import com.util.RequestManager;
import com.util.ToastUtils;
import com.youth.banner.Banner;
import com.youth.banner.loader.ImageLoader;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.xmlpull.v1.XmlPullParser;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import butterknife.ButterKnife;


public class HomeFragment2 extends Fragment {


    private Context mcontext;
    private MyApp myapp;
    private View view;
    private PullLoadMoreRecyclerView homedataRecycleView;
    private LinearLayoutManager layoutManager;
    private View bannerView;
    private MainRecyclerViewAdapter adapter;
    private View bottomView;
    private Banner banner;
    private LinearLayout loadLlay;
    private View notMoreShopView;
    private View loadMoreShopView;
    private CustomProgressDialog customProgressDialog;
    public List<String> bannerlist = new ArrayList<>();
    public List<RecommendListBean> recommendlist = new ArrayList<>();
    public List<MyCourseBean> myCourselist = new ArrayList<>();
    public List<MentalBean> mmentallist = new ArrayList<>();
    public List<FreeListBean> freeListlist = new ArrayList<>();
    private int width;
    private LinearLayout ll_mycourse;
    private LinearLayout ll_courseone;
    private ImageView img_courseone;
    private TextView tv_courseone;
    private LinearLayout ll_coursetwo;
    private ImageView img_coursetwo;
    private TextView tv_coursetwo;
    private ImageView img_buycourse;
    private View recommendView;
    private HorizontalListView horlistview;
    private LinearLayout ll_recommend;
    private HorgradeAdapter horgradeAdapter;
    private View freeView;
    private LinearLayout ll_freespeedone;
    private ImageView img_freespeedone;
    private TextView tv_freespeedone;
    private TextView tv_authorone;
    private LinearLayout ll_freespeedtwo;
    private ImageView img_freespeedtwo;
    private TextView tv_freespeedtwo;
    private TextView tv_authortwo;
    private LinearLayout ll_freespeedthree;
    private ImageView img_freespeedthree;
    private TextView tv_freespeedthree;
    private TextView tv_authorthree;
    private HorizontalListView freehorlistview;
    private HorgradeAdapter freehorgradeAdapter;
    private LinearLayout ll_train;
    private TextView tv_titletest;
    private List<HomeListBean.DataBean.BannerBean> bannerList;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        Log.e("Activity:", this.getClass().getName().toString());
        view = inflater.inflate(R.layout.fragment_home, container, false);
        mcontext = getActivity();
        myapp = (MyApp) mcontext.getApplicationContext();
        EventBus.getDefault().register(this);
        ButterKnife.bind(getActivity());
        customProgressDialog = new CustomProgressDialog(mcontext, "", R.style.CommProgressDialog);
        WindowManager.LayoutParams params = customProgressDialog.getWindow().getAttributes();
        params.alpha = 0.7f;//取值为0-1之间  0是全透明，1是不透明
        params.dimAmount=0f;   //取值为0-1之间  1是全黑
        customProgressDialog.getWindow().setAttributes(params);
        customProgressDialog.show();
        getScreenDen();
        initView();
        initTopView();
        initLin();
        getData();
        return view;

    }



    private void initView() {
        horgradeAdapter = new HorgradeAdapter(mcontext,mmentallist);
//        freehorgradeAdapter = new HorgradeAdapter(mcontext,mmentallist);
        tv_titletest = (TextView) view.findViewById(R.id.tv_titletest);
        homedataRecycleView = view.findViewById(R.id.home_data);
//        adapter = new MainRecyclerViewAdapter(recommendlist, mcontext, myapp,width);
        setHeader(homedataRecycleView);
        homedataRecycleView.setAdapter(adapter);
        homedataRecycleView.setLinearLayout();
        homedataRecycleView.setRefreshing(true);
        layoutManager = (LinearLayoutManager) homedataRecycleView.getLayoutManager();
//        GridLayoutManager gridLayoutManager = homedataRecycleView.getGridLayoutManager();
        homedataRecycleView.cancleAnimal();
        loadMoreShopView = View.inflate(mcontext, R.layout.item_moredata, null);
        notMoreShopView = View.inflate(mcontext, R.layout.item_nodata, null);

    }
    @Subscribe
    public void onEventMainThread(InfoEventMessage event) {
        String message = event.getMessage();
        Log.e("GTPCmessage--new--order", message);


    }
    */
/**
     * 设置头部布局
     *
     * @param view
     *//*

    private void setHeader(PullLoadMoreRecyclerView view) {
        //轮播图
        bannerView = LayoutInflater.from(mcontext).inflate(R.layout.item_home_banner, view, false);
        adapter.setBannerView(bannerView);
        //为您推荐
        recommendView = LayoutInflater.from(mcontext).inflate(R.layout.item_home_recommend, view, false);
        adapter.setRecommendView(recommendView);
        //免费速读
        freeView = LayoutInflater.from(mcontext).inflate(R.layout.item_home_free, view, false);
        adapter.setFreeView(freeView);

        //底部加载更多
        bottomView = LayoutInflater.from(mcontext).inflate(R.layout.main_bottom, view, false);
        adapter.setBottomView(bottomView);
    }
    */
/**
     * 初始化头部控件
     *//*

    private void initTopView() {
        //轮播图
        banner = (Banner) bannerView.findViewById(R.id.banner);
        ll_mycourse = (LinearLayout) bannerView.findViewById(R.id.ll_mycourse);
        ll_courseone = (LinearLayout) bannerView.findViewById(R.id.ll_courseone);
        img_courseone = (ImageView) bannerView.findViewById(R.id.img_courseone);
        tv_courseone = (TextView) bannerView.findViewById(R.id.tv_courseone);
        ll_coursetwo = (LinearLayout) bannerView.findViewById(R.id.ll_coursetwo);
        img_coursetwo = (ImageView) bannerView.findViewById(R.id.img_coursetwo);
        tv_coursetwo = (TextView) bannerView.findViewById(R.id.tv_coursetwo);
        img_buycourse = (ImageView) bannerView.findViewById(R.id.img_buycourse);
        //75dp
        int i = width - DensityUtil.dip2px(mcontext, 75);
        int itemwidth = i/3;

        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) ll_courseone.getLayoutParams();
        layoutParams.width = itemwidth;
        ll_courseone.setLayoutParams(layoutParams);
        LinearLayout.LayoutParams layoutParams1 = (LinearLayout.LayoutParams) ll_coursetwo.getLayoutParams();
        layoutParams1.width = itemwidth;
        ll_coursetwo.setLayoutParams(layoutParams1);
        LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) img_buycourse.getLayoutParams();
        layoutParams2.width = itemwidth;
        img_buycourse.setLayoutParams(layoutParams2);

        //为您推荐
        horlistview = freeView.findViewById(R.id.horlistview);

        ll_recommend = freeView.findViewById(R.id.ll_recommend);
        //速读训练
        ll_freespeedone = freeView.findViewById(R.id.ll_freespeedone);
        img_freespeedone = freeView.findViewById(R.id.img_freespeedone);
        tv_freespeedone = freeView.findViewById(R.id.tv_freespeedone);
        tv_authorone = freeView.findViewById(R.id.tv_authorone);
        ll_freespeedtwo = freeView.findViewById(R.id.ll_freespeedtwo);
        img_freespeedtwo = freeView.findViewById(R.id.img_freespeedtwo);
        tv_freespeedtwo = freeView.findViewById(R.id.tv_freespeedtwo);
        tv_authortwo = freeView.findViewById(R.id.tv_authortwo);
        ll_freespeedthree = freeView.findViewById(R.id.ll_freespeedthree);
        img_freespeedthree = freeView.findViewById(R.id.img_freespeedthree);
        tv_freespeedthree = freeView.findViewById(R.id.tv_freespeedthree);
        tv_authorthree = freeView.findViewById(R.id.tv_authorthree);
        freehorlistview = recommendView.findViewById(R.id.freehorlistview);
        ll_train = recommendView.findViewById(R.id.ll_train);
        freehorlistview.setAdapter(horgradeAdapter);
        //加载更多
        loadLlay = (LinearLayout) bottomView.findViewById(R.id.llay_load);
        int iq = width - DensityUtil.dip2px(mcontext, 53);
        int itemwidth2 = iq/3;
        LinearLayout.LayoutParams layoutParam3 = (LinearLayout.LayoutParams) ll_freespeedone.getLayoutParams();
        layoutParam3.width = itemwidth2;
        ll_freespeedone.setLayoutParams(layoutParam3);
        LinearLayout.LayoutParams layoutParams4 = (LinearLayout.LayoutParams) ll_freespeedtwo.getLayoutParams();
        layoutParams4.width = itemwidth2;
        ll_freespeedtwo.setLayoutParams(layoutParams4);
        LinearLayout.LayoutParams layoutParams5 = (LinearLayout.LayoutParams) ll_freespeedthree.getLayoutParams();
        layoutParams5.width = itemwidth2;
        ll_freespeedthree.setLayoutParams(layoutParams5);
    }

    private void initLin() {
        tv_titletest.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mcontext, LoginActivity.class);
                startActivity(intent);
            }
        });
        ll_courseone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int size = myCourselist.size();
                if (size > 0){
                    String id = myCourselist.get(0).getId();
                    //TODO  进入我的课程详情
                    Intent intent = new Intent(mcontext, MyCourseActivity.class);
                    intent.putExtra("id",id);
                    startActivity(intent);
                }
            }
        });
        ll_coursetwo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        horlistview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                horgradeAdapter.setCheckedItem(i);
                setRecommendData(i);
            }
        });
        freehorlistview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                horgradeAdapter.setCheckedItem(i);
                setTrainData(i);
            }
        });
        adapter.setOnItemClickListener(new MainRecyclerViewAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(int position) {

            }
        });
        homedataRecycleView.setOnPullLoadMoreListener(new PullLoadMoreRecyclerView.PullLoadMoreListener() {
            @Override
            public void onRefresh() {
                homedataRecycleView.setPullLoadMoreCompleted();
            }

            @Override
            public void onLoadMore() {
                homedataRecycleView.setPullLoadMoreCompleted();
            }

            @Override
            public void onScrollChanged(int heightTotal) {

            }

            @Override
            public void onScrollState(int type) {

            }
        });
    }
    private void getData() {
        bannerlist.clear();
        recommendlist.clear();
        myCourselist.clear();
        mmentallist.clear();
        freeListlist.clear();
        String url = myapp.getWebConfig() + "/api/banner/Content";
        HashMap<String, String> paramsMap = new HashMap<>();
        paramsMap.put("token", "");
//        paramsMap.put("is_material", apptype);
        RequestManager.getInstance(mcontext).requestAsyn(url, RequestManager.TYPE_POST_FORM, paramsMap, new RequestManager.ReqCallBack() {
            @Override
            public void onReqSuccess(Object result) {
                MyLog.e("code--result", result.toString());
                Message msg = new Message();
                try {
                    JSONObject jsonObject = new JSONObject(result.toString());
                    if (jsonObject.getString("code").equals("0")) {
                        msg.obj = jsonObject.getString("msg");
                        msg.arg1 = 0;
                        handler.sendMessage(msg);
                        return;
                    }
                    JSONObject data = jsonObject.getJSONObject("data");


                    JSONArray banner = data.getJSONArray("banner");
                    int bannerlength = banner.length();

                    for (int i = 0;i<bannerlength;i++){
                        String image = banner.getJSONObject(i).getString("image");
                        bannerlist.add(image);
                    }
                    JSONArray myCourse = data.getJSONArray("myCourse");
                    int myCourselength = myCourse.length();
                    for (int i = 0;i<myCourselength;i++){
                        MyCourseBean courseBean = new MyCourseBean();
                        courseBean.setDesc(myCourse.getJSONObject(i).getString("desc"));
                        courseBean.setId(myCourse.getJSONObject(i).getString("id"));
                        courseBean.setImage(myCourse.getJSONObject(i).getString("image"));
                        courseBean.setName(myCourse.getJSONObject(i).getString("name"));
                        courseBean.setOrder_sn(myCourse.getJSONObject(i).getString("order_sn"));
                        myCourselist.add(courseBean);
                    }
                    JSONArray mental = data.getJSONArray("mental");
                    int mentallength = mental.length();
                    for (int i = 0;i<mentallength;i++){
                        List<MentalBean.list> listlist = new ArrayList<>();
                        MentalBean mentalBean = new MentalBean();
                        mentalBean.setId(mental.getJSONObject(i).getString("id"));
                        mentalBean.setName(mental.getJSONObject(i).getString("name"));
                        JSONArray list = mental.getJSONObject(i).getJSONArray("list");
                        int listlength = list.length();
                        for (int m = 0;m<listlength;m++){
                            MentalBean.list listbean = new MentalBean.list();
                            listbean.setBegin_time(list.getJSONObject(m).getString("begin_time"));
                            listbean.setBegin_time_text(list.getJSONObject(m).getString("begin_time_text"));
                            listbean.setContent(list.getJSONObject(m).getString("content"));
                            listbean.setDescription(list.getJSONObject(m).getString("description"));
                            listbean.setEnd_time(list.getJSONObject(m).getString("end_time"));
                            listbean.setEnd_time_text(list.getJSONObject(m).getString("end_time_text"));
                            listbean.setId(list.getJSONObject(m).getString("id"));
                            listbean.setLogo_image(list.getJSONObject(m).getString("logo_image"));
                            listbean.setName(list.getJSONObject(m).getString("name"));
                            listbean.setPrice(list.getJSONObject(m).getString("price"));
                            listlist.add(listbean);
                        }
                        mentalBean.setList(listlist);
                        mmentallist.add(mentalBean);
                    }
                    JSONArray freeList = data.getJSONArray("freeList");
                    int freeListlength = freeList.length();
                    for (int i = 0;i<freeListlength;i++){
                        List<String> Stringlist = new ArrayList<>();
                        FreeListBean freelistBean = new FreeListBean();
                        freelistBean.setId(freeList.getJSONObject(i).getString("id"));
                        freelistBean.setName(freeList.getJSONObject(i).getString("name"));
                        freelistBean.setImage(freeList.getJSONObject(i).getString("image"));
                        freelistBean.setAuthor(freeList.getJSONObject(i).getString("author"));
                        freelistBean.setContent(freeList.getJSONObject(i).getString("content"));
                        JSONArray minute_num = freeList.getJSONObject(i).getJSONArray("minute_num");
                        int minute_numlength = minute_num.length();
                        for (int m = 0;m<minute_numlength;m++){
                            Stringlist.add(minute_num.getString(m));
                        }
                        freelistBean.setMinute_num(Stringlist);
                        freeListlist.add(freelistBean);
                    }

                    JSONObject recommend = data.getJSONObject("recommend");
                    JSONArray recommenddata = recommend.getJSONArray("data");
                    int recommendlength = recommenddata.length();
                    for (int i = 0;i<recommendlength;i++){
                        String id = recommenddata.getJSONObject(i).getString("id");
                        String name = recommenddata.getJSONObject(i).getString("name");
                        String logo_image = recommenddata.getJSONObject(i).getString("logo_image");
                        String description = recommenddata.getJSONObject(i).getString("description");
                        String price = recommenddata.getJSONObject(i).getString("price");
                        String begin_time = recommenddata.getJSONObject(i).getString("begin_time");
                        String end_time = recommenddata.getJSONObject(i).getString("end_time");
                        String content = recommenddata.getJSONObject(i).getString("content");
                        String begin_time_text = recommenddata.getJSONObject(i).getString("begin_time_text");
                        String end_time_text = recommenddata.getJSONObject(i).getString("end_time_text");
                        RecommendListBean recommendbean = new RecommendListBean();
                        recommendbean.setBegin_time(begin_time);
                        recommendbean.setBegin_time_text(begin_time_text);
                        recommendbean.setContent(content);
                        recommendbean.setDescription(description);
                        recommendbean.setEnd_time(end_time);
                        recommendbean.setEnd_time_text(end_time_text);
                        recommendbean.setId(id);
                        recommendbean.setLogo_image(logo_image);
                        recommendbean.setName(name);
                        recommendbean.setPrice(price);
                        recommendlist.add(recommendbean);
                    }
                    msg.arg1 = 2;
                    handler.sendMessage(msg);
                } catch (JSONException e) {
                    e.printStackTrace();
                    msg.arg1 = 1;
                    handler.sendMessage(msg);
                }
            }

            @Override
            public void onReqFailed(String errorMsg) {
                if (errorMsg.equals("未登录")){
                    Message msg = new Message();
                    msg.arg1 = 11;
                    handler.sendMessage(msg);
                }else{
                    Message msg = new Message();
                    msg.arg1 = 12;
                    handler.sendMessage(msg);
                }
            }
        });
    }



    public Handler handler = new Handler(){

        @SuppressLint("HandlerLeak")
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.arg1){
                case 0:
                    if (customProgressDialog != null){
                        if (customProgressDialog.isShowing()){
                            customProgressDialog.dismiss();
                        }
                    }
                    String obj = (String) msg.obj;
                    ToastUtils.show(obj);
                    break;
                case 1:if (customProgressDialog != null){
                    if (customProgressDialog.isShowing()){
                        customProgressDialog.dismiss();
                    }
                }

                    break;
                case 2:
                    if (customProgressDialog != null){
                        if (customProgressDialog.isShowing()){
                            customProgressDialog.dismiss();
                        }
                    }
                    banner.setVisibility(View.VISIBLE);
                    banner.setImageLoader(new GlideImageMidlllunboLoader());
                    banner.setImages(bannerlist);
                    banner.start();
                    if (myCourselist.size() > 0){
                        if (myCourselist.size() == 1){
                            ll_courseone.setVisibility(View.VISIBLE);
                            ll_coursetwo.setVisibility(View.GONE);
                            tv_courseone.setText(myCourselist.get(0).getName());
                            String image = myCourselist.get(0).getImage();
                            if (!"".equals(image)){
                                GlideUtils.loadRoundCircleImage(getActivity().getApplicationContext(),image,img_courseone);
                            }
                        }else if (myCourselist.size() == 2){
                            ll_courseone.setVisibility(View.VISIBLE);
                            ll_coursetwo.setVisibility(View.VISIBLE);
                            tv_courseone.setText(myCourselist.get(0).getName());
                            String image = myCourselist.get(0).getImage();
                            if (!"".equals(image)){
                                GlideUtils.loadRoundCircleImage(getActivity().getApplicationContext(),image,img_courseone);
                            }
                            tv_coursetwo.setText(myCourselist.get(1).getName());
                            String imagetwo = myCourselist.get(1).getImage();
                            if (!"".equals(imagetwo)){
                                GlideUtils.loadRoundCircleImage(getActivity().getApplicationContext(),imagetwo,img_coursetwo);
                            }
                        }
                    }
                    horgradeAdapter.setData(mmentallist);
//                    setRecommendData(0);
                    setTrainData(0);
                    setFreerepeed();
                    homedataRecycleView.setPullLoadMoreCompleted();
//                    adapter.setDatas(recommendlist);
                    break;
                case 3:


                    break;
                case 4:

                    break;
                case 11:
                    if (customProgressDialog != null){
                        if (customProgressDialog.isShowing()){
                            customProgressDialog.dismiss();
                        }
                    }
                    break;
                case 12:
                    if (customProgressDialog != null){
                        if (customProgressDialog.isShowing()){
                            customProgressDialog.dismiss();
                        }
                    }
                    break;
            }
        }
    };

    public void setRecommendData(int position){
        ll_recommend.removeAllViews();
        if (mmentallist.size() > 0){
            List<MentalBean.list> list = mmentallist.get(position).getList();
            int size = list.size();
            for (int i = 0;i<size;i++){
                View view = View.inflate(mcontext,R.layout.item_recoommend,null);
                ImageView img_img = view.findViewById(R.id.img_img);
                TextView tv_name = view.findViewById(R.id.tv_name);
                TextView tv_content = view.findViewById(R.id.tv_content);
                TextView tv_seedetail = view.findViewById(R.id.tv_seedetail);
                String logo_image = list.get(i).getLogo_image();
                if (!"".equals(logo_image)){
                    GlideUtils.loadRoundCircleImage(mcontext,logo_image,img_img);
                }
                tv_name.setText(list.get(i).getName());
                tv_content.setText(list.get(i).getDescription());
                ll_recommend.addView(view);
            }
        }
    }
    public void setTrainData(int position){
        ll_train.removeAllViews();
        if (mmentallist.size() > 0){
            List<MentalBean.list> list = mmentallist.get(position).getList();
            int size = list.size();
            for (int i = 0;i<size;i++){
                View view = View.inflate(mcontext,R.layout.item_recoommend,null);
                ImageView img_img = view.findViewById(R.id.img_img);
                TextView tv_name = view.findViewById(R.id.tv_name);
                TextView tv_content = view.findViewById(R.id.tv_content);
                TextView tv_seedetail = view.findViewById(R.id.tv_seedetail);
                String logo_image = list.get(i).getLogo_image();
                if (!"".equals(logo_image)){
                    GlideUtils.loadRoundCircleImage(mcontext,logo_image,img_img);
                }
                tv_name.setText(list.get(i).getName());
                tv_content.setText(list.get(i).getDescription());
                ll_train.addView(view);
            }
        }
    }
    public void setFreerepeed(){
        int size = freeListlist.size();
        if (size > 0){
            if (size == 1){
                ll_freespeedone.setVisibility(View.VISIBLE);
                ll_freespeedtwo.setVisibility(View.INVISIBLE);
                ll_freespeedthree.setVisibility(View.INVISIBLE);
                String image = freeListlist.get(0).getImage();
                if (!"".equals(image)){
                    GlideUtils.loadRoundCircleImage(mcontext,image,img_freespeedone);
                }
                tv_freespeedone.setText(freeListlist.get(0).getName());
                tv_authorone.setText(freeListlist.get(0).getAuthor());
            }else if (size == 2){
                ll_freespeedone.setVisibility(View.VISIBLE);
                ll_freespeedtwo.setVisibility(View.VISIBLE);
                ll_freespeedthree.setVisibility(View.INVISIBLE);
                String image = freeListlist.get(0).getImage();
                if (!"".equals(image)){
                    GlideUtils.loadRoundCircleImage(mcontext,image,img_freespeedone);
                }
                tv_freespeedone.setText(freeListlist.get(0).getName());
                tv_authorone.setText(freeListlist.get(0).getAuthor());

                String image2 = freeListlist.get(1).getImage();
                if (!"".equals(image2)){
                    GlideUtils.loadRoundCircleImage(mcontext,image2,img_freespeedtwo);
                }
                tv_freespeedtwo.setText(freeListlist.get(1).getName());
                tv_authortwo.setText(freeListlist.get(1).getAuthor());
            }else if (size == 3){
                ll_freespeedone.setVisibility(View.VISIBLE);
                ll_freespeedtwo.setVisibility(View.VISIBLE);
                ll_freespeedthree.setVisibility(View.VISIBLE);
                String image = freeListlist.get(0).getImage();
                if (!"".equals(image)){
                    GlideUtils.loadRoundCircleImage(mcontext,image,img_freespeedone);
                }
                tv_freespeedone.setText(freeListlist.get(0).getName());
                tv_authorone.setText(freeListlist.get(0).getAuthor());

                String image2 = freeListlist.get(1).getImage();
                if (!"".equals(image2)){
                    GlideUtils.loadRoundCircleImage(mcontext,image2,img_freespeedtwo);
                }
                tv_freespeedtwo.setText(freeListlist.get(1).getName());
                tv_authortwo.setText(freeListlist.get(1).getAuthor());

                String image3 = freeListlist.get(2).getImage();
                if (!"".equals(image3)){
                    GlideUtils.loadRoundCircleImage(mcontext,image3,img_freespeedthree);
                }
                tv_freespeedthree.setText(freeListlist.get(2).getName());
                tv_authorthree.setText(freeListlist.get(2).getAuthor());
            }
        }
    }

    public class GlideImageMidlllunboLoader extends ImageLoader {

        @Override
        public ImageView createImageView(Context context) {


            XmlPullParser parser = getResources().getXml(R.xml.layout_ratioimageview);
            AttributeSet attributes = Xml.asAttributeSet(parser);

            ImageView imageView = new RatioImageView(context, attributes);

            return imageView;
        }

        @Override
        public void displayImage(final Context context, final Object path, ImageView imageView) {
//            Glide.with(getApplicationContext()).load(path).transform(new FitCenter(context), new GlideRoundTransform(context)).into(imageView);
            if ("".equals(path)){
                imageView.setImageResource(R.mipmap.ic_launcher);
            }else {
                GlideUtils.loadRoundCircleImage(context, path + "", imageView);
            }
        }
    }
    private boolean islogin = false;

    */
/**
     * 获取屏幕宽度
     *//*

    private void getScreenDen() {
//        dm = new DisplayMetrics();
//        heightPixels = dm.heightPixels;
//        getWindowManager().getDefaultDisplay().getMetrics(dm);

        WindowManager manager = getActivity().getWindowManager();
        DisplayMetrics dm = new DisplayMetrics();
        manager.getDefaultDisplay().getMetrics(dm);
        //以要素为单位
        width = dm.widthPixels;
        int heightPixels = dm.heightPixels;
        MyLog.e("获取屏幕高度", heightPixels + "    高度   "+ width);
    }



    @Override
    public void onResume() {
        super.onResume();

        MyLog.e("首页","onResume");
    }
    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);
        MyLog.e("首页","onHiddenChanged     "+hidden);

    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }

}
*/
